<template>
  <view class="discounts-details">
    <!-- <web-view :src="allUrl"></web-view> -->
     {{  }}
     <image class="img_box" :src="docUrl" mode="widthFix" >
      
     </image>
     <!-- <image class="" :src="docUrl" mode="aspectFit|aspectFill|widthFix" lazy-load="false" binderror="" bindload="">
      
     </image> -->
    <!-- <web-view v-if="allUrl !== ''" :src="allUrl"></web-view> -->
    <!-- <view class="discounts-title" >
    {{ ruleData.ruleName }}
  </view>
  <view class="discounts-content" >
    活动内容：{{ ruleData.ruleInfo }}
  </view>
  <view class="discounts-time" >
    活动创建时间：{{ ruleData.createTime }}
  </view> -->
  </view>
</template>
<script setup>

import { ref } from "vue";
import {
  getDiscountsRulesApi,
  getConfigEnterpriseFieldsApi,
} from "@/api/user/index";
import { onLoad, onShow } from "@dcloudio/uni-app";
const docUrl = ref("");
const ruleData = ref({});
const ruleName = ref("");
const allUrl = ref("");
const viewerUrl = ref('/hybrid/html/web/viewer.html');

const getDiscountsRules = async () => {
  const res = await getConfigEnterpriseFieldsApi("权益规则");
  console.log("getDiscountsRulesApi", res);
  const { code, data } = res;
  if (code === 200) {
    console.log(data);
    // ruleData.value = data.find(i => i.id == ruleName.value);
    docUrl.value = data[0].children.find(
      (i) => i.id == ruleName.value
    ).resourceUrl;
    // console.log("docUrl.value",docUrl.value);
    
  }
};
onLoad((option) => {
  ruleName.value = option.name;
  getDiscountsRules();
});
</script>
<style scoped lang=less>
@import url(./less/discounts.less);
</style>
